﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="ResetPassword.aspx.cs" Inherits="User_ResetPassword" Title="Reset Password" %>

<asp:Content ID="Content2" ContentPlaceHolderID="cpHeader" runat="Server">

    <script src="/includes/ValidationError-NEW.js" type="text/javascript"></script>

    <script src="/includes/ValidationEffect-NEW.js" type="text/javascript"></script>

</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cpBody" runat="Server">
    <div id="container">
        <div class="body">
            <div class="topcol">
            </div>
            <div class="body">
                <div class="padding_lr15px">
                    <!-- Column Content | Start -->
                    <div class="col_content_full">
                        <div class="topcol">
                        </div>
                        <div class="body">
                            <div class="padding_lr30px">
                                <h3>
                                    <%= GetGlobalResourceObject("Menu","ResetPassword") %>
                                </h3>
                                <div class="seperator_15px">
                                </div>
                                <div id="CarForm">
                                    <asp:Label ID="lblAutoKey" Visible="false" runat="server"></asp:Label>
                                    <asp:Label ID="lblGUID" Visible="false" runat="server"></asp:Label>
                                    <asp:ValidationSummary ID="vsResetPassword" CssClass="errorSummary" HeaderText="Oops... Please complete the form"
                                        runat="server" ValidationGroup="resetpassword" />
                                    <div>
                                        <div class="form_col_1 comp left">
                                            <%= GetGlobalResourceObject("Menu","EnterNewPassword") %></div>
                                        <div class="form_col_2 left">
                                            <asp:TextBox ID="txtNewPassword" runat="server" MaxLength="20" Width="200px" TextMode="Password"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvNewPassword" CssClass="validationErrorControl"
                                                runat="server" ControlToValidate="txtNewPassword" Display="Dynamic" ErrorMessage=""
                                                Text="" ValidationGroup="resetpassword">
                                            </asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                    <div class="seperator_form">
                                    </div>
                                    <div>
                                        <div class="form_col_1 comp left">
                                            <%= GetGlobalResourceObject("Menu","RetypeNewPassword") %></div>
                                        <div class="form_col_2 left">
                                            <asp:TextBox ID="txtRetypeNewPassword" runat="server" MaxLength="20" Width="200px"
                                                TextMode="Password"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvRetypePassword" CssClass="validationErrorControl"
                                                runat="server" ValidationGroup="resetpassword" ErrorMessage="" Text="" Display="Dynamic"
                                                ControlToValidate="txtRetypeNewPassword"></asp:RequiredFieldValidator>
                                            <asp:CompareValidator ID="csvRetypePassword" runat="server" CssClass="validationErrorControl"
                                                Display="Dynamic" ValidationGroup="resetpassword" ErrorMessage="" Text="Both password should be same."
                                                ControlToValidate="txtRetypeNewPassword" ControlToCompare="txtNewPassword"></asp:CompareValidator>
                                        </div>
                                    </div>
                                    <div class="seperator_form">
                                    </div>
                                    <div class="seperator_15px">
                                    </div>
                                    <div>
                                        <div class="form_col_1 left">
                                            &nbsp;
                                        </div>
                                        <div class="form_col_2 left">
                                            <asp:Button ID="btnSubmit" CssClass="button_resetpassword" OnClientClick="LoadValidationErrorCss();if (Page_ClientValidate('resetpassword')){this.className = 'button_w_processing';}"
                                                runat="server" OnClick="btnSubmit_Click" ValidationGroup="resetpassword" />
                                        </div>
                                    </div>
                                    <div>
                                        <div class="form_col_1 left">
                                            &nbsp;
                                        </div>
                                        <div class="form_col_2 left">
                                            <asp:Label ID="lblMessage" ForeColor="Red" runat="server"></asp:Label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- Column Content | End   -->
                        <!-- Column Right | Start -->
                        <!-- Column Right | End   -->
                    </div>
                </div>
            </div>
            <div class="bottom">
            </div>
        </div>
    </div>

    <script type="text/javascript">
        function CheckPasswordLength(source, arguments) {
            //var corglen = arguments.Value;
            var cval = arguments.Value;
            var bValid = true;
            var chList = new Array(20);
            var ctrlsource = document.getElementById(source.id);

            //alert("ORG LEN : " + corglen.length + " AFTER : " + cval.length);
            if (cval.indexOf(' ') != -1 || cval.indexOf('\'') != -1
                        || cval.indexOf('\"') != -1 || cval.indexOf('~') != -1) {
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password include invalid character or space!";
                }
                else {
                    ctrlsource.innerText = "Password include invalid character or space!";
                }

                ctrlsource.errormessage = "Password include invalid character or space!";
                bValid = false;
            }
            else if (cval.length < 6) {
                //ctrlsource.innerText = "Password length should be at least 6";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should be at least 6";
                }
                else {
                    ctrlsource.innerText = "Password length should be at least 6";
                }

                ctrlsource.errormessage = "Password length should be at least 6";
                bValid = false;
            }
            else if (cval.length > 20) {
                bValid = false;
                //ctrlsource.innerText = "Password length should not be over 20!";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should not be over 20!";
                }
                else {
                    ctrlsource.innerText = "Password length should not be over 20!";
                }
                ctrlsource.errormessage = "Password length should not be over 20!";
            }
            else {
                bValid = true;
            }
            //alert(cval);
            //if (isNaN(cval)){
            //    bValid = false;
            //} 


            //alert(bValid);
            arguments.IsValid = bValid;
            return;
        }
    </script>

</asp:Content>
